package Main;

import User.*;

import java.util.Scanner;

public class Main {

    private static User login(){
        Scanner in = new Scanner(System.in);
        System.out.println("图书借阅系统登录~");
        System.out.println("请输入您的姓名：");
        String userName = in.nextLine();
        System.out.println("请选您的身份： 1.管理员用户    2.普通用户");
        int selection = in.nextInt();
        if(selection == 1){
            return new AdminUser(userName);
        }else if(selection == 2){
            return new NormalUser(userName);
        }else{
            System.out.println("选择错误，请重试!");
            return null;
        }
    }

    public static void main(String[] args) {
        User user = null;
        while((user = login()) == null);

        while(true){
            int selection = user.menu();
            user.operate(selection);
        }

    }
}
